import {
  BaseEntity,
  Column,
  CreateDateColumn,
  DeleteDateColumn,
  Entity,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';

@Entity()
export class Article extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({
    comment: '语言',
    nullable: true,
    unique: false,
    default: 'en',
    type: 'varchar',
  })
  lang: string;

  @Column({
    comment: '文章标题',
    nullable: false,
    unique: false,
    default: null,
    type: 'text',
  })
  title: string;

  @Column({
    comment: 'SEO关键词',
    nullable: false,
    unique: true,
    default: null,
    type: 'varchar',
  })
  seoKeywords: string;

  @Column({
    comment: '文章详情',
    nullable: true,
    unique: false,
    default: null,
    type: 'text',
  })
  detail: string;

  @Column({
    comment: '文章主图',
    nullable: true,
    unique: false,
    default: null,
    type: 'varchar',
  })
  imageSrc: string;

  @Column({
    comment: '启用时间',
    nullable: true,
    default: 0,
  })
  startTime: number;

  @CreateDateColumn()
  createTime: Date;

  @UpdateDateColumn()
  updateTime: Date;

  @DeleteDateColumn({ nullable: true })
  deleteTime: Date;
}
